$(function() {
var dates = $('#from, #to').datepicker({
defaultDate: "-1m",
		changeMonth: true,
		changeYear: true,
		dateFormat: 'yy-mm-dd',
                firstDay: 1 ,
		numberOfMonths: 3,
		onSelect: function(selectedDate) {
			var option = this.id == "from" ? "minDate" : "maxDate";
			var instance = $(this).data("datepicker");
			var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
			dates.not(this).datepicker("option", option, date);
				}
		});
	});